<%--
    -Author Zac Burke
    -Main Page for capturing initial registrant info
--%>
<%@ taglib uri="struts-html" prefix="html" %>
<%@ taglib uri="struts-logic" prefix="logic" %>
<%@ taglib uri="struts-bean" prefix="bean" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>

<!--Set the onLoad function here-->
<c:set var="onloadFunction" scope="session" value="document.registrationForm.registrantTypeId.focus();"/>

<jsp:include page="../common/top.jsp"/>
<script language="JavaScript" type="text/JavaScript">
<!--
	selectRegistrant();
	function selectRegistrant()
	{
		
		var regCombo = document.getElementById('regTypeCombo');
		var currentItem = regCombo[regCombo.selectedIndex].value;
		var contactTable = document.getElementById('contactTable');
		if(currentItem != 1){
			contactTable.style.visibility = 'visible';
			contactTable.style.display = 'block';
		}else{
			if(contactTable.style.visibility == "visible"){
				contactTable.style.visibility = 'hidden';
				contactTable.style.display = 'none';
			}
		}
		
			
	}
	
//-->
</script>


<%-- Uncomment this to enable javascript validation!
     <html:javascript formName="registrationForm"/>
--%>
<logic:messagesPresent>
<br>
 <div class="error"><div><div><div><div><div><div><div>
   		<html:messages id="error" message="false">
			<table  class="errorTable">
				<tr>
					<td> <bean:write name="error"/></td>
				<tr>	
			</table>
   		</html:messages>
		</div></div></div></div></div></div></div></div>
	</logic:messagesPresent>

  <html:form action="/struts/register/registrationAction">

   	<c:if test = '${sessionScope.ejcSession.convention.conventionStatus=="INACTIVE"}'>
   	
   		<table class="errorTable">
   			<tr>
   				<td><b>
   					<br/>
   					Warning! Registration is temporarily INACTIVE. No new Registrants can be added at this time.<br/><br/>
   					Please click <html:link page="/struts/register/registrationAction.do?methodToCall=preCreate">here</html:link> to refresh this page.
   					</b>
   				</td>
   			</tr>
   		</table>
   	</c:if>

  <fmt:bundle basename="org.ejc.resources.Messages">
  <table width="100%">
	<td align="left">
		<table class="inputStyle" cellspacing="5">
			<tr><td colspan="2" class="sectionTitle"><fmt:message key="page.registration.personalDetails" /></td></tr>
			<tr><td></td></tr>
			<tr>
				<td>Type</td>
				<td><html:select property="registrantTypeId" styleId="regTypeCombo" styleClass="inputValue" errorStyleClass="errorInput" onchange="selectRegistrant();">
						<html:options collection="registrantTypes" property="registrantTypeId" labelProperty="registrantTypeDesc"/>
					</html:select></td>
			</tr>
			<tr>
				<td><fmt:message key="page.registration.firstName" /></td>
				<td><html:text property="firstName" styleClass="inputValue" errorStyleClass="errorInput"/></td>
			</tr>
			<tr>
				<td><fmt:message key="page.registration.lastName" /></td>
				<td><html:text property="lastName" styleClass="inputValue" errorStyleClass="errorInput"/></td>
				
			</tr>
			<tr>
				<td><fmt:message key="page.registration.country" /></td>
				<td><html:select property="countryCodeCountryId" styleClass="inputValue" errorStyleClass="errorInput">
						<html:option value="0">Please Select</html:option>
						<html:options collection="countries" property="countryId" labelProperty="countryIsoCode"/>
					</html:select></td>
			</tr>
			<tr>
				<td>Age Bracket</td>
				<td>
					<html:select property="ageBracket" styleClass="inputValue" errorStyleClass="errorInput">
						<html:option value="N/A">N/A</html:option>
						<html:option value="1-12">1-12</html:option>
						<html:option value="13-18">13-18</html:option>
						<html:option value="19-25">19-25</html:option>
						<html:option value="25+">25+</html:option>
					</html:select>
					
				</td>
			</tr>
			<tr>
				<td><fmt:message key="page.registration.email" /></td>
				<td><html:text property="email" styleClass="inputValue" errorStyleClass="errorInput"/></td>
			</tr>
			<tr>
				<td valign="top"><fmt:message key="page.registration.notes" /></td>
				<td><html:textarea property="notes" styleClass="inputValue" errorStyleClass="errorInput"/></td>
			</tr>
			
			<tr>
				<td><fmt:message key="page.registration.accomodationtype" /></td>
				<td><html:select property="accomodationTypeId" styleClass="inputValue" errorStyleClass="errorInput">
						<html:option value="0">Please Select</html:option>
						<html:options collection="accomodationTypes" property="accomodationTypeId" labelProperty="accomodationDesc"/>
					</html:select></td>
			</tr>
			<tr>
				<td><fmt:message key="page.registration.lengthofstay" /></td>
				<td><html:select property="lengthOfStay" styleClass="inputValue" errorStyleClass="errorInput">
						<html:option value="1">1</html:option>
						<html:option value="2">2</html:option>
						<html:option value="3">3</html:option>
						<html:option value="4">4</html:option>
						<html:option value="5">5</html:option>
						<html:option value="6">6</html:option>
						<html:option value="7">7</html:option>
					</html:select></td>
			</tr>
			<tr>
				<td><fmt:message key="page.registration.prereg"/></td>
				<td align="left" cellpadding="0"><html:checkbox property="preRegistration"/> </td>
			</tr>
			
			
			
			<tr>
				<td>
					<c:if test = '${sessionScope.ejcSession.convention.conventionStatus !="INACTIVE"}'>
						<html:submit property="" value="Create" styleClass="button"/>
					</c:if>
						<input type="hidden" name="methodToCall" value="createRegistrant" />
				</td>
			</tr>
			
		</table>
		</td>
		<td align="left">
<table id="contactTable" class="inputStyleHidden" cellspacing="5">
			<tr><td colspan="2" class="sectionTitle"><fmt:message key="page.registration.contactDetails" /></td></tr>
			<tr><td></td></tr>
			<tr>
				<td><fmt:message key="page.registration.address1" /></td>
				<td><html:text property="addressLine1" styleClass="inputValue" errorStyleClass="errorInput"/></td>
			</tr>
			<tr>
				<td><fmt:message key="page.registration.address2" /></td>
				<td><html:text property="addressLine2" styleClass="inputValue" errorStyleClass="errorInput"/></td>
				
			</tr>
			<tr>
				<td><fmt:message key="page.registration.cityTown" /></td>
				<td><html:text property="cityTown" styleClass="inputValue" errorStyleClass="errorInput"/></td>
			</tr>
			<tr>
				<td valign="top"><fmt:message key="page.registration.contactNumber" /></td>
				<td><html:text property="contactNumber" styleClass="inputValue" errorStyleClass="errorInput"
				onkeypress="return noChars(event)"/></td>
			</tr>
			<tr><td>&nbsp;</td></tr>
			<tr><td>&nbsp;</td></tr>
			<tr><td>&nbsp;</td></tr>
			<tr><td>&nbsp;</td></tr>
			<tr><td>&nbsp;</td></tr>
			<tr><td>&nbsp;</td></tr>
			<tr><td>&nbsp;</td></tr>
			<tr><td>&nbsp;</td></tr>
			<tr><td>&nbsp;</td></tr>
			<tr><td>&nbsp;</td></tr>
		</table>
		</td>
		</table>
		
			
		
			</fmt:bundle>
        
		  </html:form>
<script language="JavaScript" type="text/JavaScript">
<!--
	selectRegistrant();

//-->
</script>
<jsp:include page="../common/bottom.jsp" />
